@echo off
echo Compiling Workflow Management System...

REM Create output directory
if not exist "target\classes" mkdir target\classes

REM Compile main classes (without dependencies for now)
echo Compiling core classes...
javac -d target\classes -cp . -encoding UTF-8 src\main\java\com\sjw\workflow\core\*.java
if %errorlevel% neq 0 (
    echo Core compilation failed
    exit /b 1
)

echo Compiling DAG classes...
javac -d target\classes -cp target\classes -encoding UTF-8 src\main\java\com\sjw\workflow\dag\*.java
if %errorlevel% neq 0 (
    echo DAG compilation failed
    exit /b 1
)

echo Compiling agent classes...
javac -d target\classes -cp target\classes -encoding UTF-8 src\main\java\com\sjw\workflow\agent\*.java
if %errorlevel% neq 0 (
    echo Agent compilation failed
    exit /b 1
)

echo Compiling engine classes...
javac -d target\classes -cp target\classes -encoding UTF-8 src\main\java\com\sjw\workflow\engine\*.java
if %errorlevel% neq 0 (
    echo Engine compilation failed
    exit /b 1
)

echo Compiling example classes...
javac -d target\classes -cp target\classes -encoding UTF-8 src\main\java\com\sjw\workflow\example\*.java
if %errorlevel% neq 0 (
    echo Example compilation failed
    exit /b 1
)

echo Compiling main class...
javac -d target\classes -cp target\classes -encoding UTF-8 src\main\java\com\sjw\Main.java
if %errorlevel% neq 0 (
    echo Main compilation failed
    exit /b 1
)

echo Compilation completed successfully!
echo.
echo To run the demo:
echo java -cp target\classes com.sjw.Main
